<!--
 * @Description: 减脂营编辑按钮
 * @Version: 1.0
 * @Author: Yuanjy
 * @Date: 2020-05-12 11:25:18
 * @LastEditors: Yuanjy
 * @LastEditTime: 2020-05-12 17:18:58
 -->
<template>
  <div>
    <!-- <el-button size="mini" type="success" @click="to">编辑</el-button> -->
    <i class="update icon-revamp" title="修改" @click="to"></i>
    <eForm ref="form" :second-channels="secondChannels" :sup-this="supThis" :is-add="false"/>
  </div>
</template>
<script>
import eForm from './form'

export default {
  components: { eForm },
  props: {
    data: {
      type: Object,
      required: true
    },
    supThis: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      secondChannels: []
    }
  },
  methods: {
    to() {
      this.initParams()
      const _this = this.$refs.form
      _this.form = {
        id: this.data.id,
        channel_code: this.data.channel_code,
        camp_name: this.data.camp_name,
      }
      _this.dialog = true
    },
    initParams() {
      //查询渠道信息
      this.$api.enterprise.channel
        .cascadeSecond({
          params: { status: 1 }
        })
        .then(res => {
          this.secondChannels = res.data.channels
        }).catch(err => {
          console.log(err)
        })
    }
  }
}
</script>

<style scoped>
  div{
    display: inline-block;
    margin-right: 3px;
  }
</style>
